<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<p:panel id="contentEdit">
		<h:form id="formulario">
			<p:tabView id="tabCliente" dynamic="true">
				<p:tab title="Godfather Part I" id="tabFrmClientes">
					<h:form id="frmDemo">
						<ui:repeat var="item" value="#{demoBean.selectedCliente}">
							<h:panelGrid columns="2" cellpadding="10">
								<h:outputLabel value="Codigo" />
								<h:inputText value="#{item.codigo}" />
							</h:panelGrid>
							<h:panelGrid columns="2" cellpadding="10">
								<h:outputLabel value="Nombre" />
								<h:inputText value="#{item.nombre}" />
							</h:panelGrid>
							<h:panelGrid columns="2" cellpadding="10">
								<h:outputLabel value="Apellido" />
								<h:inputText value="#{item.apellido}" />
							</h:panelGrid>
						</ui:repeat>
						<p:commandButton value="Agregar"
							actionListener="#{demoBean.agregar()}"
							update=":formulario:tabCliente:formTable" />
						<p:commandButton value="Modificar"
							actionListener="#{demoBean.modificar()}" />
						<p:commandButton value="Nuevo"
							actionListener="#{demoBean.nuevo()}" />
						<p:commandButton value="Eliminar"
							actionListener="#{demoBean.eliminar()}" />
					</h:form>
					<h:form id="formTable">
						<p:dataTable id="eventsDT" var="cliente" value="#{demoBean.lista}"
							selectionMode="single" selection="#{demoBean.selectedCliente}"
							rowKey="#{cliente.codigo}">
							<p:ajax event="rowSelect" listener="#{demoBean.onRowSelect}"
								update=":formulario:tabCliente:frmDemo" />
							<p:column headerText="Id">
								<h:outputText value="#{cliente.codigo}" />
							</p:column>
							<p:column headerText="Nombre">
								<h:outputText value="#{cliente.nombre}" />
							</p:column>
							<p:column headerText="Apellido">
								<h:outputText value="#{cliente.apellido}" />
							</p:column>
						</p:dataTable>
					</h:form>

				</p:tab>
				<p:tab title="Godfather Part II">
					<h:form id="formNuevo">
						<h:panelGrid columns="2" cellpadding="10">
							<h:outputText value="Francis Ford Coppola's legendary..." />
						</h:panelGrid>
						<p:commandButton value="Agregar"
							actionListener="#{demoBean.agregar()}" update="formNuevo" />
					</h:form>

				</p:tab>
				<p:tab title="Godfather Part III">
					<h:form>
						<h:panelGrid columns="2" cellpadding="10">
							<h:outputText value="After a break of more than 15 years..." />
						</h:panelGrid>
						<p:commandButton value="Nuevo"
							actionListener="#{clientesMBean.nuevoLocal()}" />
					</h:form>

				</p:tab>
			</p:tabView>
		</h:form>
	</p:panel>
</ui:composition>
</html>